package com.example.minesweepers;

import android.app.AlertDialog;
import android.app.Dialog;
import android.app.AlertDialog.Builder;
import android.content.Context;
import android.content.DialogInterface;

public class StartNewGameDialog extends Dialog {
	private Context context;

	public StartNewGameDialog(Context context) {
		super(context);
		this.context = context;
	}

	/**
	 *  User gets to choose a dialog but to get the user choice they must invoke getDialogChoise() - boolean;
	 * @param title - dialog title
	 * @param message - dialog message
	 */
	public void isStartingNewGameDialog(String title, String message, DialogInterface.OnClickListener actionOnYesClick) {
		AlertDialog.Builder startNewGameDialogBuilder = new Builder(this.context);
		
		startNewGameDialogBuilder.setTitle(title);
		startNewGameDialogBuilder.setMessage(message);

		startNewGameDialogBuilder.setPositiveButton("Yes", actionOnYesClick);

		startNewGameDialogBuilder.setNegativeButton("No",
				new DialogInterface.OnClickListener() {

					@Override
					public void onClick(DialogInterface dialog, int which) {
						dialog.cancel();
					}
				});
		
		AlertDialog dialog = startNewGameDialogBuilder.create();
		dialog.show();
	}
}
